<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// Tests moving the caret forward/backward through content of mixed editability.
// The caret should move to same editability in highet editable root.
selection_test(
  [
    '<div contenteditable>',
      'ab',
      '<table contenteditable="false"><tbody><tr>',
        '<td contenteditable>|CD</td>',
      '</tr></tbody></table>',
      'ef',
    '</div>',
  ],
  selection => selection.modify('move', 'backward', 'line'),
  [
    '<div contenteditable>',
      '|ab',
      '<table contenteditable="false"><tbody><tr>',
        '<td contenteditable>CD</td>',
      '</tr></tbody></table>',
      'ef',
    '</div>',
  ],
  '1 move backward line');

selection_test(
  [
    '<div contenteditable>',
      'ab',
      '<table contenteditable="false"><tbody><tr>',
        '<td contenteditable>|CD</td>',
      '</tr></tbody></table>',
      'ef',
    '</div>',
  ],
  selection => selection.modify('move', 'forward', 'documentBoundary'),
  [
    '<div contenteditable>',
      'ab',
      '<table contenteditable="false"><tbody><tr>',
        '<td contenteditable>CD</td>',
      '</tr></tbody></table>',
      'ef|',
    '</div>',
  ],
  '2 move forward documentBoundary');
</script>
